package com.firebird.app.kotlin.stock.trend.activity

import android.os.Bundle
import android.view.View
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import androidx.viewpager.widget.ViewPager
import com.firebird.app.kotlin.stock.trend.adapter.QuotationFragmentAdapter
import com.firebird.app.kotlin.stock.trend.fragment.FragmentStockFenShi
import com.firebird.app.kotlin.stock.trend.view.FooterMenuView
import com.firebird.app.kotlin.stock.trend.R
import kotlinx.android.synthetic.main.layout_menu_footer.view.*
import java.util.*


/**
 * 显示股市详情（分时走势，K线）的窗口类
 * @author ljk
 * @date   2019年10月30日
 */
class StockDetailActivity : FragmentActivity() {
    private var viewPager: ViewPager? = null
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        this.setContentView(R.layout.activity_stock_detail)
        //初始化底部菜单控件
        val menu = findViewById<View>(R.id.footer_menu) as FooterMenuView
        menu.setCurrentMenu(R.id.menu_quotation)
        menu.setOnTouchListener(menu.MenuOnTouchListener())
        viewPager = findViewById<View>(R.id.vp_fragment) as ViewPager
        //viewPager.setAdapter(new WelcomeAdapter(getPagers()));
        viewPager!!.adapter = QuotationFragmentAdapter(supportFragmentManager, createFragments())
    }

    private fun createFragments(): ArrayList<Fragment> {
        val list: ArrayList<Fragment> = ArrayList<Fragment>()
        val fs = FragmentStockFenShi()
        list.add(fs)
        return list
    }
}
